package com.example.xzc.cainiaoshangcheng.Activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.widget.TextView;

import com.example.xzc.cainiaoshangcheng.R;
import com.example.xzc.cainiaoshangcheng.Adapter.TestAdapter;
import com.example.xzc.cainiaoshangcheng.widget.FullyLinearLayoutManager;

import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

import java.util.ArrayList;
import java.util.List;

/**
 * @projectName: CaiNiaoShangCheng    ---------> 项目名称
 * @description: ScrollView嵌套RecycleView
 * @author: xzc                              --------->作者
 * @date: 2017-03-14    --------->日期
 * @time: 11:02               --------->时间
 */

public class Test1Activity extends AppCompatActivity {

    @ViewInject(R.id.rv_test1)
    private RecyclerView rv_test1;

    @ViewInject(R.id.tv_test1)
    private TextView tv_test1;

    private TestAdapter myAdapter;
    private List<String> datas;

    private StringBuilder sb = new StringBuilder();

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test1);

        x.view().inject(this);

        initData();
        initView();

    }

    private void initData() {
        datas = new ArrayList<>();
        for(int i=0; i<50; i++){
            datas.add("test"+i);
        }

        for(String str : datas){
            sb.append(str);
        }

    }

    private void initView() {
        rv_test1.setLayoutManager(new FullyLinearLayoutManager(this,FullyLinearLayoutManager.VERTICAL, false));
        myAdapter = new TestAdapter(datas,this);
        rv_test1.setAdapter(myAdapter);

        tv_test1.setText(sb.toString());
    }
}
